<?php

/*
 * author: wiloke
 * author uri: wiloke.com
 * date: 05/02/2014
 * time: 02 PM
 */

$aContactDetails = get_post_meta($post->ID, $post->post_type, true);

$instance = isset($aContactDetails['contact_details']) ? $aContactDetails['contact_details'] : array();


$instance = wp_parse_args($instance, array( 'info' => array(' '), 'icon'=>array('fa fa-refresh') ) );
?>
<div class="postbox">
    <div class="handlediv" title="Click to toggle">
        <br>
    </div>
    <h3 class="hndle">
        <span>Contact Info</span>
    </h3>

    <div class="inside">
        <div class="bt-reset">
            <div class="container-12-fluid">
                <div class="container-12-row">
                    <?php
                    foreach ($instance['info'] as $k => $v) :
                        ?>
                        <div class="clone-me wrap-delete large-4">

                            <div class="panel">
                                <div class="panel-heading">
                                    <div class="panel-title">&nbsp;</div>
                                    <div class="panel-options">
                                        <a href="#" class="delele-this"><i class="fa fa-times"></i></a>
                                    </div>
                                </div>

                                <div class="panel-body">
                                    <div class="form-group">
                                        <label class="form-label">Icon</label>
                                        <div class="controls">
                                            <a class="available-panel thickbox" href="#TB_inline&width=600&height=600&inlineId=table-fa">
                                                <i class="is_icon <?php echo $instance['icon'][$k] ?>"></i>
                                            </a>
                                            <input type="hidden" class="is_icon service_icon" name="contact_details[icon][]" value="<?php echo $instance['icon'][$k] ?>"/>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="form-label">Information</label>
                                        <div class="controls">
                                            <textarea class="widefat service_name reset form-control" name="contact_details[info][]"> <?php echo htmlspecialchars($v)  ?></textarea>
                                        </div>
                                    </div>


                                </div>
                            </div>
                        </div>
                    <?php
                    endforeach;
                    ?>
                    <div class="bo-add-new wo-wrapclone">
                        <div class="">
                            <button class="btn btn-blue aboutus wo-addmore" type="button">Add More</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
